package com.game;

import java.util.Vector;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.view.MotionEvent;

public class Scene6 extends Scene {

	private Vector<Bitmap> m_Slides;
	private int m_CurSlide;
	private ButtonOneTouch m_Button;
	
	public Scene6(SceneManager parent)
	{
		super(parent);
		
		m_Slides = new Vector<Bitmap>();
		m_CurSlide = 0;
		
		m_Slides.add(LoadBitmap(R.drawable.scene6_01));
		m_Slides.add(LoadBitmap(R.drawable.scene6_02));
		m_Slides.add(LoadBitmap(R.drawable.scene6_03));
		m_Slides.add(LoadBitmap(R.drawable.scene6_04));
		m_Slides.add(LoadBitmap(R.drawable.scene6_05));
		m_Slides.add(LoadBitmap(R.drawable.scene6_06));
		m_Slides.add(LoadBitmap(R.drawable.scene6_07a));
		m_Slides.add(LoadBitmap(R.drawable.scene6_08));
		m_Slides.add(LoadBitmap(R.drawable.scene6_09));
		
		m_Button = new ButtonOneTouch(0, 435, 290, LoadBitmap(R.drawable.scene6_arrow));		
		
	}
	
	@Override
	public void Draw(Canvas canvas) 
	{
		if(m_CurSlide < m_Slides.size())
		{
			canvas.drawBitmap(m_Slides.elementAt(m_CurSlide), 0, 0, null);
		}
		m_Button.Draw(canvas);
	}

	@Override
	public void End() {
		// TODO Auto-generated method stub

	}

	@Override
	public void Start() {
		// TODO Auto-generated method stub

	}

	@Override
	public void Update() 
	{
		if(m_Button.Used())
		{
			m_CurSlide++;
			m_Button.Unselect();
		}
		
		if(m_CurSlide >= m_Slides.size())
		{
			mParentSM.ChangeScene(new Scene3(mParentSM));
		}

	}

	@Override
	public boolean handleTouch(MotionEvent event) {
		synchronized (mSurfaceHolder) 
		{
			int tx,ty;
			tx = (int)event.getX();
			ty = (int)event.getY();
			
			
			m_Button.TryTouch(tx, ty);	
			
		}
		return true;
	}

}
